package com.sky.web.data1.customer.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.sky.web.data1.customer.entity.Customer;
import com.sky.web.data1.customer.service.CustomerService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@Api(description = "data1-客户")
public class CustomerController {
	@Autowired
	public CustomerService customerService;
	
	@ApiOperation(value = "获取客户") 
	@ApiImplicitParams({
		@ApiImplicitParam(name = "id" , value = "id" , paramType = "query" , required = false ),
		@ApiImplicitParam(name = "customerName" , value = "customerName" , paramType = "query" , required = false )
	})
	@RequestMapping(value="/getCustomer")
	public List<Customer> getCustomer(@RequestBody Customer customer) {
		String desc = "desc";
		System.out.println("简单参数："+desc);
		System.out.println(customer.toString());
		return customerService.getCustomer(customer);
	}
	
	@ApiOperation(value = "字符串测试") 
	@ApiImplicitParams({
		@ApiImplicitParam(name = "desc" , value = "desc" , paramType = "query" , required = false )
	})
	@RequestMapping(value="/getString")
	public String getString( String desc){
		return customerService.getString(desc);
	}
	
	@ApiOperation(value = "字符串测试2") 
	@ApiImplicitParams({
		@ApiImplicitParam(name = "str1" , value = "str1" , paramType = "query" , required = false ),
		@ApiImplicitParam(name = "str2" , value = "str2" , paramType = "query" , required = false )
	})
	@RequestMapping(value="/getString2")
	public String getString2( String str1,String str2){
		return customerService.getString(str1,str2);
	}
}
